<%-- 
    Document   : index
    Created on : 25-ott-2011, 21.27.09
    Author     : Admin
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Esercizio 05 - Parola palindroma con JSP</title>
    </head>
    <body>
        <%
            String parola = request.getParameter("parola");
            if (parola == null)
                parola = "";
            
            boolean result = true;
            
            for(int i = 0; i < parola.length(); ++i)
            {
                if(parola.charAt(i) != parola.charAt(parola.length() - i - 1))
                {
                    result = false;
                    break;
                }
            }
        %>
        <p>
            La parola <%= parola %>
            <!-- qui avviene la magia -->
            <%= result ? "" : "non" %>
            &egrave; palindroma.
        </p>
    </body>
</html>
